home *** CD-ROM | disk | FTP | other *** search
/ Utilities Professional 1-1500 / Utilities Professional 1-1500 (1994)(WPD)[!].iso / 07511000 / var0888.dms / var0888.adf / WoManD / man / C_Library / fopen < prev    next >
Text File  |  1992-09-19  |  2KB  |  58 lines

  1. FOPEN(1)                    C LIBRARY FUNCTIONS                     FOPEN(1)
  2.  
  3. NAME
  4.      fopen, freopen - to open a stream
  5.  
  6. SYNOPSIS
  7.      FILE *fopen(char *filename,char *type);
  8.  
  9.      FILE *freopen(char *filename,char *type,FILE *stream);
  10.  
  11. INCLUDE FILE
  12.      stdio.h
  13.  
  14. DESCRIPTION
  15.      fopen() opens the file named by filename and associates a stream with 
  16.          it. If the open succeeds, fopen() returns a pointer to be used to
  17.          identify the stream in subsequent operations.
  18.  
  19.          -filename points to a character string that contains the name of 
  20.           the file to be opened.
  21.  
  22.          -type is a character string having one of the following values:
  23.  
  24.           r      open for reading
  25.  
  26.           w      truncate or create for writing
  27.  
  28.           a      append: open for writing at end of file, or create for
  29.                  writing
  30.  
  31.           r+     open for update (reading and writing)
  32.  
  33.           w+     truncate or create for update (read and write).
  34.  
  35.           a+     append; open or create for update at EOF
  36.  
  37.          a 'b' can also be added to these mode to signify that the file is
  38.          a binary file. For example: "r+b" or "rb+".
  39.          When a file is open for both reading and writing a call to fflush()
  40.          or to one of fseek(), fsetpos() or rewind() must be performed
  41.          between a read and a write.
  42.  
  43.    freopen() opens the file named by filename and associates the stream
  44.          pointed to by stream with it. The type argument is used just as
  45.          in fopen(). The original stream is closed, regardless of whether
  46.          the open ultimately succeeds. If the open succeeds, freopen()
  47.          returns the original value of stream. If it fails, it returns NULL.
  48.  
  49.    freopen() is typically used to redirect to files the preopened streams
  50.          associated with stdin, stdout, and stderr.
  51.  
  52. RETURN VALUES
  53.    On success, fopen(), and freopen() return a pointer to FILE which
  54.    identifies the opened stream. On failure, they return NULL.
  55.  
  56. SEE ALSO
  57.    fclose(), fflush().
  58.